package com.zhangwei.expands.recycler;

import android.content.Context;
import android.net.Uri;
import android.widget.TextView;

import com.base.lib.adapter.RcCommonAdapter;
import com.base.lib.adapter.vh.ViewHolder;
import com.facebook.drawee.view.SimpleDraweeView;
import com.zhangwei.expands.R;
import com.zhangwei.expands.recycler.bean.DataItem;

import java.util.List;

public class HotRecyclerAdapter extends RcCommonAdapter<DataItem> {

    public HotRecyclerAdapter(Context context, List<DataItem> list) {
        super(context, list);
    }

    @Override
    public int onCreateViewLayoutID(int viewType) {
        return 0;
    }

    @Override
    public void onBindViewHolder(ViewHolder holder, int position) {
        DataItem item = list.get(position);
        TextView priceTxt = holder.getTextView(R.id.item_staggered_price);
        priceTxt.setText(item.getPrice());
        TextView favTxt = holder.getTextView(R.id.item_staggered_fav);
        favTxt.setText(String.valueOf(item.getFavorites_count()));
        SimpleDraweeView sv = holder.findById(R.id.item_staggered_img);
        sv.setImageURI(Uri.parse(item.getCover_image_url()));
    }
}
